package com.zbkj.crmeb.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 加价类型
 * @Description:
 * @author daigb
 * @date 2021-01-15
 */
public enum PriceTypeEnum implements IEnum<Integer> {
    /**
     * 分类加价率
     */
    CATE(0, "分类加价率"),
    /**
     * 固定价格
     */
    FIXED(1, "固定价格"),
    /**
     * 加价
     */
    RAISE(2, "加价"),
    /**
     * 加价率
     */
    MARKUP(3, "加价率"),
    /**
     * 原价折扣
     */
    DISCOUNT(4, "折扣"),

    ;

    private final Integer code;
    private final String msg;

    PriceTypeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    @JsonCreator
    public static PriceTypeEnum valueOf(Integer code) {
        for (PriceTypeEnum value : values()) {
            if (code.equals(value.getCode())) {
                return value;
            }
        }
        return PriceTypeEnum.RAISE;
    }

    @Override
    @JsonValue
    public Integer getValue() {
        return code;
    }

}

